﻿@model IEnumerable<WeProjects.Models.MemberViewModel>

@{
    ViewBag.Title = "Index";
}

<h2>用户列表</h2>

<p class="buttonIn">
    @Html.ActionLink("新建用户", "Create")
</p>
<table class="table">
    <tr>
        <th>
            用户名
        </th>
        <th>
            姓名
        </th>
        <th>角色</th>
        <th>操作</th>
    </tr>
    
    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.DisplayName)
            </td>
            <td>
                @{string roles = "";}
                @foreach (var role in item.RoleList)
                {
                    if (role.IsSelected)
                    {
                        roles += role.TranslatedRoleName + " ";
                    }
                }
                @Html.DisplayFor(x => roles)
            </td>
            <td>
                @Html.ActionLink("编辑", "Edit", new { id = item.ID }, new { @class = "btn btn-success btn-small" })&nbsp;
                @*@Html.ActionLink("详细", "Details", new { id=item.ID })&emsp;*@
                @Html.ActionLink("删除", "Delete", new { id = item.ID }, new { @class = "btn btn-danger btn-small" })
            </td>
        </tr>
    }

</table>
